<template>
<slot :controller="controller" :store="store" :model="model">
        <div :class="classNames">
            <a-tabs v-bind="$attrs" v-model:activeKey="store.activeKey" @tabClick="handleTabPanelClick">
                <a-tab-pane key="tabviewpanel2" forceRender>
                    <slot  name="IBIZSample0003STabExpViewtabviewpanel2Content" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <IBIZSample0003STabExpViewtabviewpanel2TabViewPanel
                            name="tabviewpanel2"    
                            :context="store.context"
                            :viewParams="store.viewParams"
                            @ctrl-init="(name: string, ability: any) => { handleCtrlInit(controller, name, ability) }"
                            @ctrl-action="(name: string, action: any, data: any) => { handleCtrlAction(controller, name, action, data) }"
                            @ctrl-destroy="(name: string, data: any) => { handleCtrlDestroy(controller, name, data) }"
                        />
                    </slot>
                    <template #tab>
                        <slot name="IBIZSample0003STabExpViewtabviewpanel2Caption" :controller="controller" :store="store" :model="model">
                            <AppIconText text="图书" textPSLanguageRes="OTHER.IBIZSAMPLE0003STABEXPVIEW.TABVIEWPANEL2"  v-badge="store.counterData?.['']"></AppIconText>
                        </slot>
                    </template>
                </a-tab-pane>
                <a-tab-pane key="tabviewpanel3" forceRender>
                    <slot  name="IBIZSample0003STabExpViewtabviewpanel3Content" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <IBIZSample0003STabExpViewtabviewpanel3TabViewPanel
                            name="tabviewpanel3"    
                            :context="store.context"
                            :viewParams="store.viewParams"
                            @ctrl-init="(name: string, ability: any) => { handleCtrlInit(controller, name, ability) }"
                            @ctrl-action="(name: string, action: any, data: any) => { handleCtrlAction(controller, name, action, data) }"
                            @ctrl-destroy="(name: string, data: any) => { handleCtrlDestroy(controller, name, data) }"
                        />
                    </slot>
                    <template #tab>
                        <slot name="IBIZSample0003STabExpViewtabviewpanel3Caption" :controller="controller" :store="store" :model="model">
                            <AppIconText text="软件" textPSLanguageRes="OTHER.IBIZSAMPLE0003STABEXPVIEW.TABVIEWPANEL3"  v-badge="store.counterData?.['']"></AppIconText>
                        </slot>
                    </template>
                </a-tab-pane>
                <a-tab-pane key="tabviewpanel" forceRender>
                    <slot  name="IBIZSample0003STabExpViewtabviewpanelContent" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <IBIZSample0003STabExpViewtabviewpanelTabViewPanel
                            name="tabviewpanel"    
                            :context="store.context"
                            :viewParams="store.viewParams"
                            @ctrl-init="(name: string, ability: any) => { handleCtrlInit(controller, name, ability) }"
                            @ctrl-action="(name: string, action: any, data: any) => { handleCtrlAction(controller, name, action, data) }"
                            @ctrl-destroy="(name: string, data: any) => { handleCtrlDestroy(controller, name, data) }"
                        />
                    </slot>
                    <template #tab>
                        <slot name="IBIZSample0003STabExpViewtabviewpanelCaption" :controller="controller" :store="store" :model="model">
                            <AppIconText text="统一产品" textPSLanguageRes="OTHER.IBIZSAMPLE0003STABEXPVIEW.TABVIEWPANEL"  v-badge="store.counterData?.['']"></AppIconText>
                        </slot>
                    </template>
                </a-tab-pane>
                <template #leftExtra v-if="hasSlot('ViewCaption')">
                    <slot name="ViewCaption" />
                </template>
            </a-tabs>
        </div>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@TABEXPPANEL}}-tab-exp-panel/{{spinalCase ctrl.codeName}}-tab-exp-panel-base.vue.hbs生成
import IBIZSample0003STabExpViewtabviewpanel2TabViewPanel from '@widgets/ibiz-sample-0003/s-tab-exp-viewtabviewpanel-2-tab-view-panel/s-tab-exp-viewtabviewpanel-2-tab-view-panel.vue';
import IBIZSample0003STabExpViewtabviewpanel3TabViewPanel from '@widgets/ibiz-sample-0003/s-tab-exp-viewtabviewpanel-3-tab-view-panel/s-tab-exp-viewtabviewpanel-3-tab-view-panel.vue';
import IBIZSample0003STabExpViewtabviewpanelTabViewPanel from '@widgets/ibiz-sample-0003/s-tab-exp-viewtabviewpanel-tab-view-panel/s-tab-exp-viewtabviewpanel-tab-view-panel.vue';
import { useProps, useBasic, useAction, useController } from './s-tab-exp-viewtabexppanel-tab-exp-panel-hook';
import { TabExpPanelActionType, ITabExpPanelAbility, ITabExpPanelStore, IParam } from "@/core/interface";

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    controlID, 
    getClassNames, 
    useNavParamsBind, 
    useEventBind, 
    handleCtrlDestroy,
    handleCtrlInit, 
    handleCtrlAction,
} = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: TabExpPanelActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: ITabExpPanelAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  return getClassNames(props);
});

const controller = useController(props, evt, { controlID });

const { handleTabPanelClick, hasSlot } = useAction(controller);

useNavParamsBind(controller, props);

const store: ITabExpPanelStore = controller.getStore();

onMounted(() => {
    controller.ctrlMounted();
});

onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>
